package com.jltx.xq.simplewatch.news.api;

import com.jltx.xq.simplewatch.news.model.bean.TopicNewsResponse;
import com.jltx.xq.simplewatch.news.model.bean.TopicNewsVideoResponse;

import io.reactivex.Observable;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Query;

/**
 * @author jltxseo
 * @date 2017/09/05.
 * @description:
 */

public interface TopicNewsApi {
    String GET_ARTICLE_LIST = "api/news/feed/v62/?refer=1&count=20&loc_mode=4&device_id=34960436458&iid=13136511752";

    @GET(GET_ARTICLE_LIST)
    Observable<String> getTopicNewsJson(@Query("category") String channel, @Query("min_behot_time") long lastTime, @Query("last_refresh_sub_entrance_interval") long currentTime);

    @GET(GET_ARTICLE_LIST)
    Observable<TopicNewsResponse> getTopicNews(@Query("category") String category, @Query("min_behot_time") long lastTime, @Query("last_refresh_sub_entrance_interval") long currentTime);

    /**
     * 获取视频数据json
     * @param link
     * @param r
     * @param s
     * @return
     */
    @Headers({
            "Content-Type:application/x-www-form-urlencoded; charset=UTF-8",
            "Origin:http://toutiao.iiilab.com",
            "User-Agent:Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36"

    })
    @POST("http://service.iiilab.com/video/toutiao")
    Observable<String> getTopicNewsVideoPathJson(@Query("link") String link,@Query("r") String r,@Query("s") String s);


    /**
     * 获取视频数据json
     * @param
     * @param r
     * @param s
     * @return
     */
    @Headers({
            "Content-Type:application/x-www-form-urlencoded; charset=UTF-8",
            "Origin:http://toutiao.iiilab.com",
            "User-Agent:Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36"

    })
    @POST("http://service.iiilab.com/video/toutiao")
    Observable<TopicNewsVideoResponse> getTopicNewsVideoPath(@Query("link") String newSrcUrl, @Query("r") String r, @Query("s") String s);

}
